package com.example.idachuappone.activie;

import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import com.example.idachuappone.BaseActivity;
import com.example.idachuappone.R;
import com.example.idachuappone.index.welcomentity.Events;

public class ActiveWebActivity extends BaseActivity {
    private Button btn_back;
    private Events events;
    private WebView webView;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_active_web);
        this.events = (Events) getIntent().getExtras().get("events");
        initView();
    }

    private void initView() {
        rightNone();
        this.tv_title.setText("\u6d3b\u52a8\u8be6\u60c5");
        this.webView = (WebView) findViewById(R.id.webView1);
        this.webView.getSettings().setJavaScriptEnabled(true);
        this.webView.setWebViewClient(new WebViewClient() {
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                view.loadUrl(url);
                return false;
            }
        });
        this.btn_back = (Button) findViewById(R.id.btn_back);
        this.btn_back.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                if (ActiveWebActivity.this.webView.canGoBack()) {
                    ActiveWebActivity.this.webView.goBack();
                } else {
                    ActiveWebActivity.this.finish();
                }
            }
        });
        this.webView.loadUrl(this.events.getExt_url());
    }
}
